package com.leyou.trade.interceptors;

import com.leyou.auth.constants.JwtConstants;
import com.leyou.trade.utils.CookieContext;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.stereotype.Component;


/**
 * feign的拦截器声明，只拦截feign的请求
 */
@Component
public class FeignCookieInterceptor implements RequestInterceptor {
    @Override
    public void apply(RequestTemplate template) {

        //向请求头加入内容
        template.header("cookie", JwtConstants.COOKIE_NAME+"="+ CookieContext.getCookie());
    }
}
